
/**
 * created on 2012-03-21
 * @author  qiujz
 * @version 1.0
 *
 * Copyright (c)  Founder Software (Suzhou) Co., Ltd.  2012
 *  All rights reserved.
 *
 * 
 * ================================================================
 * Change Revision
 * ---------------------------------------------------------------
 *    DATE                BY                   COMMENT
 * ---------------------------------------------------------------
 * 2012-03-21         qiujz                Create class
 * 
 *
 * ================================================================
 */	

package com.founder.bm.dao.impl;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.founder.mh.framework.dao.impl.BaseDaoImpl;
import com.founder.bm.dao.IEnrollDtlDao;
import com.founder.bm.entity.EnrollDtlTo;	

public class EnrollDtlDaoImpl extends BaseDaoImpl implements IEnrollDtlDao {
	/** 
	 * @inheritDoc
	 * @see com.founder.bm.dao.IEnrollDtlDao
	 *      #searchEnrollDtlList(java.util.Map)
	 */
	public List<EnrollDtlTo> searchEnrollDtlList(
			Map<String, Object> paramMap) {
		return this.queryForList("enrollDtl.searchEnrollDtl", paramMap);
	}

	/** 
	 * @inheritDoc
	 * @see com.founder.bm.dao.IEnrollDtlDao
	 *      #searchEnrollDtlPagination(java.util.Map, int, int)
	 */
	public List<EnrollDtlTo> searchEnrollDtlPagination(
			Map<String, Object> paramMap, int startRow, int endRow) {
		return this.queryForListPagination("enrollDtl.searchEnrollDtl",
				paramMap, startRow, endRow);
	}
	
	/** 
	 * @inheritDoc
	 * @see com.founder.bm.dao.IEnrollDtlDao
	 *      #getEnrollDtlCount(java.util.Map)
	 */
	public Integer getEnrollDtlCount(Map<String, Object> paramMap) {
		return (Integer) this.queryForObject("enrollDtl.getEnrollDtlCount", paramMap);
	}
	
	
	/** 
	 * @inheritDoc
	 * @see com.founder.bm.dao.IEnrollDtlDao
	 *      #getEnrollDtlByPrimaryKey(String)
	 */
	public EnrollDtlTo getEnrollDtlByPrimaryKey(String dtlId) {
		return (EnrollDtlTo) queryForObject("enrollDtl.getEnrollDtlByPrimaryKey", dtlId);
	}
	

	/** 
	 * @inheritDoc
	 * @see com.founder.bm.dao.IEnrollDtlDao
	 *      #insertEnrollDtl(com.founder.bm.entity.EnrollDtlTo)
	 */
	public Object insertEnrollDtl(EnrollDtlTo enrollDtl) {
		return this.create("enrollDtl.insertEnrollDtl", enrollDtl);		
	}

	/** 
	 * @inheritDoc
	 * @see com.founder.bm.dao.IEnrollDtlDao
	 *      #updateEnrollDtlByBean(com.founder.bm.entity.EnrollDtlTo)
	 */
	public int updateEnrollDtlByBean(EnrollDtlTo enrollDtl) {
		return this.update("enrollDtl.updateEnrollDtl.byBean", enrollDtl);
	}

	/** 
	 * @inheritDoc
	 * @see com.founder.bm.dao.IEnrollDtlDao
	 *      #updateEnrollDtlByProperty(java.util.Map)
	 */
	public int updateEnrollDtlByProperty(Map<String, Object> paramMap) {
		return this.update("enrollDtl.updateEnrollDtl.byProperty", paramMap);
	}

	
	/** 
	 * @inheritDoc
	 * @see com.founder.bm.dao.IEnrollDtlDao
	 *      #deleteEnrollDtlByPrimaryKey(String)
	 */
	public int deleteEnrollDtlByPrimaryKey(String userId) {
		return this.delete("enrollDtl.deleteEnrollDtlByPrimaryKey", userId);
	}
	
	/** 
	 * @inheritDoc
	 * @see com.founder.bm.dao.IEnrollDtlDao
	 *      #deleteEnrollDtlBatch(String[])
	 */
	public void deleteEnrollDtlBatch(String[] keyArray) {
		SqlMapClient sqlMap = this.getSqlMapClient();
		try {
			sqlMap.startBatch();
			for (String key : keyArray) {
				sqlMap.delete("enrollDtl.deleteEnrollDtlByPrimaryKey",
						key);
			}
			sqlMap.executeBatch();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
		
}	
	
